<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      document.write("打印出100-200中所有质数");
      document.write("<br>");
      var sum = 0;
      for (var i = 100; i <= 200; i++) {
        var tag = 0;
        for (var j = 2; j <= i / 2; j++) {
          if (i % j == 0) ++tag;
        }
        if (tag === 0) {
          document.write(i + " ");
          sum += i;
        }
      }
      document.write("<br>");
      document.write(sum + " <br>");
    </script>
  </body>
</html>
